package servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import DAO.CourseDao;
import DAO.StudentDao;
import DTO.Course;
import DTO.Student;

public class tianjiahuodongServlet extends HttpServlet {
 
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	    String cId=req.getParameter("cid")	;
		String cName=req.getParameter("cname")	;
			//2
		Course s=new Course();
		s.setcId(cId);
		s.setcName(cName);
		
		CourseDao sd=new CourseDao();
			
			int flag=sd.insertIntoCourse(s);
			if(flag==1)
			resp.sendRedirect(req.getContextPath()+"/admin/admin.html");
			else
				resp.sendRedirect(req.getContextPath()+"/admin/zhucehuodong.html");
			//3
		}
}

